package com.zdoon.service.impl;

import com.zdoon.mapper.EmpMapper;
import com.zdoon.pojo.JobOption;
import com.zdoon.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private EmpMapper empMapper;
    @Override
    public JobOption getEmpJobData() {
//        获取数据
        List<Map<String, Object>> jobList = empMapper.selectEmpJobData();
//        组装结果到JobOption中
        List<Object> posList = jobList.stream().map(item -> item.get("pos")).toList();
        List<Object> dataList = jobList.stream().map(item -> item.get("num")).toList();

        return new JobOption(posList, dataList);
    }

    @Override
    public List<Map<String, Object>> getEmpGenderData() {
        return empMapper.selectEmpGenderData();
    }
}
